package com.bupt.secret.execption;


/**
 * 自定义异常
 *
 * @author wzy
 * @date 2016年10月27日 下午10:11:27
 */

import com.bupt.secret.utils.ResultCode;

/**
 * @desc 自定义异常
 * @author shishumin
 * @date 2024/9/5 09:01
 */
public class BuptException extends RuntimeException {
    private String msg;
    private int code = 500;
    // 错误参数
    private String[] msgParams;

    public BuptException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public BuptException(String msg, String... params) {
        super(msg);
        this.msg = msg;
        this.msgParams = params;
    }

    public BuptException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }

    public BuptException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    public BuptException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.msg = resultCode.getMessage();
        this.code = resultCode.getCode();
    }

    public BuptException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object[] getMsgParams() {
        return msgParams;
    }

    public void setMsgParams(String[] msgParams) {
        this.msgParams = msgParams;
    }
}
